<?php
## include config & db info##
include $_SERVER['DOCUMENT_ROOT']."/pos/lib/list.php";

## include HTML Insert heade ##
include $_SERVER['DOCUMENT_ROOT']."/pos/lib/head_insert.php";

## include SQL header ##
include $_SERVER['DOCUMENT_ROOT']."/pos/lib/array_sql.php";
?>

<body>
	<!-- onload="javascript:init();" -->
	<div style="width: 1024px; padding: 10px;">
		<div style="border-bottom: 1px solid #e8e8e8; text-align: left; font-size: 12px; margin-bottom: 12px; color: #9a9a9a">
		::: 고객 관리&nbsp;⇒&nbsp;고객 정보 마스터&nbsp;⇒&nbsp;고객 추가하기</div>
		<form name="insert" method="post" action="query.php"
			enctype="multipart/form-data">
			<input type="hidden" value="" name="before" /> <input type="hidden"
				value="insert" name="mode" />
			<div id=register>
			<?php
			if($_POST['mode']=='modify'){
				$Idx = $_POST['chk_no'];
				for($i=0;$i<count($Idx);$i++){
					## 기존 내용 가져오기 
					$query  = sprintf(posSql("customer_info_import"),$Idx[$i]); //"select * from $table where no = $no[$i]";
					$list = DBarray($query);
				?>

				<!--   /////////////////////	  기존 내용 수정하기	 ///////////////////// -->
				<input type="hidden" value="<?=$Idx[$i]?>" name="Idx[]" />

				<ul class='line'></ul>
				<!-- onload="javascript:test();" -->
				<ul>
					<li class="lable">고객번호</li>
					<!--  readonly onclick="javascript:chk_id();"  -->
					<!-- input type='text' size='20' name='barcode[]' value="" readonly onclick="javascript:chk_barcode('<=$table?>',this.value);"/--->
					<li class='value'><?=$list['usercode']?></li>
				</ul>
				<ul>
					<li class="lable">성명</li>
					<li class='value'><?=$list['name']?></li>
				</ul>
				<ul>
					<li class="lable">성명(가나)</li>
					<li class='value'><input type='text' size='20' name='namekana[]'
						value="<?=$list['namekana']?>" /></li>
				</ul>
				<ul>
					<li class="lable">우편번호</li>
					<li class="value"><input type="text" size="20" name="zip[]"
						value="<?=$list['zip']?>" /></li>
				</ul>
				<ul>
					<li class="lable">주소</li>
					<li class="value"><input type="text" size="50" name="addr1[]"
						value="<?=$list['addr1']?>" /></li>
				</ul>
				<ul>
					<li class="lable">Tel</li>
					<li class="value"><input type="text" size="20" name="tel[]"
						value="<?=$list['tel']?>" /></li>
				</ul>
				<ul>
					<li class="lable">Phone</li>
					<li class="value"><input type="text" size="20" name="phone[]"
						value="<?=$list['phone']?>" /></li>
				</ul>
				<ul>
					<li class="lable">Fax</li>
					<li class="value"><input type="text" size="20" name="fax[]"
						value="<?=$list['fax']?>" /></li>
				</ul>
				<ul>
					<li class="lable">E-mail</li>
					<li class="value"><input type="text" size="20" name="email[]"
						 value="<?=$list['email']?>" /></li> <!-- onblur="mail_check(this)" -->
				</ul>
				<ul>
					<li class="lable">직업</li>
					<li class="value"><input type="text" size="20" name="job[]"
						value="<?=$list['job']?>" /></li>
				</ul>
				<ul>
					<li class="lable">성별</li>
					<li class='value'>
<?php
						if($list['mw']=='m'){
							echo "남";
						}else{
							echo "여";
						}
?>				
				</ul>
				<ul>
					<li class="lable">나이</li>
					<li class="value"><input type="text" size="20" name="age[]"
						value="<?=$list['age']?>" /></li>
					<li class='explain'>:: 숫자만 입력 가능합니다.</li>
				</ul>
				<ul>
					<li class="lable">생년월일</li>
					<li class="value"><?=$list['birth']?></li>
				</ul>
				<ul>
					<li class="lable">생성일</li>
					<li class="value"><?=$list['writeday']?></li>
				</ul>
				<ul>
					<li class='lable'>mailing에 동의</li>
					<li class='value'>	
						<?if($list['mailingck']=='1'){?>
							<input type='checkbox' name='mailingck[]' value="1" <?if($list['mailingck']=='1') echo "checked";?> />
						<?}else{?>	
							<input type='checkbox' name='mailingck[]' value="1"/>
						<?}?>		
					</li>
				</ul>

				<ul class='line'></ul>
				<ul class='line'></ul>

				<!--   /////////////////////	  기존 내용 수정하기	 ///////////////////// -->			
			
			<?php }
			}else{
			?>
			
				<!--   /////////////////////  새로운 내용 입력하는 부분    ///////////////////// -->
				
			<input type="hidden" value="" name="Idx[]"/>
			<ul class='line'></ul>
					<ul class='line'></ul>
				<ul>
					<li class="lable">고객번호</li>
					<!--  readonly onclick="javascript:chk_id();"  -->
					<!-- input type='text' size='20' name='barcode[]' value="" readonly onclick="javascript:chk_barcode('<=$table?>',this.value);"/--->
					<li class='value'><input type='text' size='20' name='usercode[]' onkeyup="number_check(this)"/></li>
					<li class='explain'>:: 중복 불가능 하며 숫자만 입력 가능합니다.</li>							
				</ul>							
				<ul>
					<li class="lable">성명</li>
					<li class='value'><input type='text' size='20' name='name[]'/></li>
				</ul>
				<ul>
					<li class="lable">성명(가나)</li>
					<li class='value'><input type='text' size='20' name='namekana[]'/></li>					
				</ul>
				<ul>
					<li class="lable">우편번호</li>
					<li class="value"><input type="text" size="20" name="zip[]"/></li>
				</ul>
				<ul>
					<li class="lable">주소</li>
					<li class="value"><input type="text" size="50" name="addr1[]"/></li>
				</ul>				
				<ul>
					<li class="lable">Tel</li>
					<li class="value"><input type="text" size="20" name="tel[]" /></li>
				</ul>
				<ul>
					<li class="lable">Phone</li>
					<li class="value"><input type="text" size="20" name="phone[]"/></li>				
				</ul>
				<ul>
					<li class="lable">Fax</li>
					<li class="value"><input type="text" size="20" name="fax[]"/></li>				
				</ul>
				<ul>
					<li class="lable">E-mail</li>
					<li class="value"><input type="text" size="20" name="email[]" /></li>					
				</ul>
				<ul>
					<li class="lable">직업</li>
					<li class="value"><input type="text" size="20" name="job[]"/></li>					
				</ul>
				<ul>
					<li class="lable">성별</li>					
					<li class='value'>
						<input type='radio' name='mw[]' value='m' /> 남자
						<input type='radio' name='mw[]' value='w' /> 여자				
					</li>		
				</ul>
				<ul>
					<li class="lable">나이</li>
					<li class="value"><input type="text" size="20" name="age[]"/></li>				
					<li class='explain'>:: 숫자만 입력 가능합니다.</li>					
				</ul>
				<ul>
					<li class="lable">생년월일</li>
					<li class="value">
					<input type="text" name="birth[]" value='Click!' readonly 
					onclick="displayCalendar(this,'yyyy/mm/dd',this);"/>		
					</li><li class='explain'>:: 날짜를 선택해주세요.</li>	
				</ul>
				<ul>
					<li class="lable">생성일</li>
					<li class="value">
					<input type="text" name="writeday[]" value='Click!' readonly 
					onclick="displayCalendar(this,'yyyy/mm/dd',this);"/>	
					</li><li class='explain'>:: 날짜를 선택해주세요.</li>	
				</ul>
				<ul>
					<li class='lable'>mailing에 동의</li>					
					<li class='value'>
					<input type='checkbox' name='mailingck[]' value="1" /></li>				
				</ul>					
					
			<!--   /////////////////////  새로운 내용 입력하는 부분    ///////////////////// -->
			
		<?php }
			mysql_free_result($list);
			mysql_close();
		?>
		<ul class='line'></ul>
	</div>
			<div style="padding: 5px;" align="center">
				<input type="submit" class="button white small" value="입력하기" /> <input
					type="button" class="button white small" value="취소하기"
					onclick="javacsript:location.href='view.php'" />
			</div>
		</form>
	</div>
</body>
</html>
